Computing floating-point polynomials in an integrated circuit device

ABSTRACT

Polynomial circuitry for calculating a polynomial having terms including powers of an input variable, where the input variable is represented by a mantissa and an exponent, includes at least one respective coefficient table for each respective term, each respective coefficient table being loaded with a plurality of respective instances of a coefficient for said respective term, each respective instance being shifted by a different number of bits. The circuitry also includes decoder circuitry for selecting one of the respective instances of the coefficient for each respective term based on the exponent and on a range, from among a plurality of ranges, of values into which that input variable falls.

CROSS REFERENCE TO RELATED APPLICATION

This is a continuation-in-part of copending, commonly-assigned U.S. patent application Ser. No. 13/234,419, filed Sep. 16, 2011, which is hereby incorporated by reference herein in its entirety.

FIELD OF THE INVENTION

This invention relates to computing floating-point polynomials in integrated circuit devices such as programmable logic devices (PLDs), and particularly to computing floating-point polynomials using fixed-point resources.

BACKGROUND OF THE INVENTION

Horner's rule (also referred to as Horner's scheme or Horner's algorithm) is an efficient way of calculating polynomials, useful for both hardware and software.

A polynomial can be described as:

$\begin{matrix} {{p(x)} = {{\sum\limits_{i = 0}^{n}{a_{i}x^{i}}} = {a_{0} + {a_{1}x} + {a_{2}x^{2}} + {a_{3}x^{3}} + \ldots + {a_{n}x^{n}}}}} & (1) \end{matrix}$ For an example where n=5, this can be reformatted using Horner's rule as: p(x)=a ₀ +x(a ₁ +x(a ₂ +x(a ₃ +x(a ₄ +a ₅ x))))  (2) This has the advantage of removing the calculations of powers of x (the result would be similar for any n, except that the number of terms would be different). There are still as many addition operations as there are coefficients, and as many multiplication operations as there are terms of x. For this case of n=5, there are five addition operations, and five multiplication operations.

However, even for a small number of terms, substantial resources may be required. For example, applications in which these operations are used frequently call for double-precision arithmetic (11-bit exponent and 52-bit mantissa). In a PLD such as those sold by Altera Corporation under the trademark STRATIX®, this could translate to approximately 8,500 adaptive look-up tables (ALUTs) and 45 18×18 multipliers. There also are applications calling for quadruple-precision arithmetic (15-bit exponent and 112-bit mantissa), requiring even more resources.

SUMMARY OF THE INVENTION

The present invention relates to method and circuitry for implementing floating-point polynomial series calculations using fixed-point resources. This reduces the amount of resources required, and also reduces datapath length and therefore latency. Some embodiments of the invention are particularly well-suited to applications for which the input range can be kept small. Other embodiments are suited for larger inputs. The circuitry can be provided in a fixed logic device, or can be configured into a programmable integrated circuit device such as a programmable logic device.

According to one aspect of the invention, denormalization operations are performed using the coefficients, instead of using arithmetic and logic resources to calculate and implement the denormalization, and the renormalization requires only a single-bit calculation. The remainder of the calculation can be carried out as a fixed-point calculation, consuming corresponding device area and with corresponding latency, while the results are equivalent to performing the same calculation using double-precision floating-point arithmetic.

In accordance with embodiments of the invention, there is provided polynomial circuitry for calculating a polynomial having terms including powers of an input variable, where the input variable is represented by a mantissa and an exponent. The circuitry includes at least one respective coefficient table for each respective term, each respective coefficient table being loaded with a plurality of respective instances of a coefficient for said respective term, each respective instance being shifted by a different number of bits. The circuitry also includes decoder circuitry for selecting one of the respective instances of the coefficient for each respective term based on the exponent and on a range, from among a plurality of ranges, of values into which that input variable falls.

A method of configuring a programmable device as such polynomial circuitry is also provided, and a non-transitory machine-readable data storage medium is provided that is encoded with software for performing the method of configuring such circuitry on a programmable device.

BRIEF DESCRIPTION OF THE DRAWINGS

Further features of the invention, its nature and various advantages will be apparent upon consideration of the following detailed description, taken in conjunction with the accompanying drawings, in which like reference characters refer to like parts throughout, and in which:

FIG. 1 shows an example of circuitry according to an embodiment of the invention;

FIG. 2 shows an example of sets of shifted exponents for different ranges of input values;

FIG. 3 shows an example of a set of coefficient tables for one range of input values;

FIG. 4 shows an example of a set of coefficient tables for another range of input values;

FIG. 5 shows an example of merged coefficient tables for the ranges of FIGS. 3 and 4;

FIG. 6 shows another example of circuitry according to an embodiment of the invention;

FIG. 7 is a cross-sectional view of a magnetic data storage medium encoded with a set of machine-executable instructions for performing a method according to the present invention;

FIG. 8 is a cross-sectional view of an optically readable data storage medium encoded with a set of machine executable instructions for performing a method according to the present invention; and

FIG. 9 is a simplified block diagram of an illustrative system employing a programmable logic device incorporating the present invention.

DETAILED DESCRIPTION OF THE INVENTION

Circuitry according to the invention implements Horner's rule for floating-point polynomial calculations by using the coefficients to perform denormalization and performing the remainder of the calculation as a fixed-point calculation. For any particular implementation of a polynomial calculation, each coefficient may be stored in a table as multiple versions of itself, each shifted a different amount. The exponent of the coefficient term could function as the index to the table, selecting the correct shifted version.

Different ranges of coefficient values may be applicable to different ranges of input values. For example, for small inputs (i.e., input values less than 1), coefficient values for the higher-order terms of the polynomial are rarely needed, because the contributions from the higher-order terms are generally beyond the precision of the output. At the opposite extreme, for inputs much greater than 1, coefficient values for the higher-order terms may be the most significant, because those terms will contribute the most to the output.

An embodiment of the invention for small inputs (i.e., inputs less than 1) may be understood by reference to an example of the inverse tangent (tan⁻¹, ATAN or arctan) function. The inverse tangent function can be computed using the following series:

$\begin{matrix} {{\arctan(x)} = {x - \frac{x^{3}}{3} + \frac{x^{5}}{5} - {\frac{x^{4}}{7}\ldots}}} & (3) \end{matrix}$ Using Horner's rule, this can be expressed as:

$\begin{matrix} {{\arctan(x)} = {x + {x^{3}\left( {\frac{- 1}{3} + \frac{x^{2}}{5} - {\frac{x^{4}}{7}\ldots}} \right)}}} & (4) \\ {{\arctan(x)} = {x + {x\left( {0 + {x\left( {0 + {x\left( {\frac{- 1}{3} + {{x\left( {0 + \frac{x}{5}} \right)}\ldots}} \right)}} \right)}} \right)}}} & (5) \end{matrix}$ This uses two adders and five multipliers, although if equation (4) is limited to two terms it can be implemented using two adders and only three multipliers.

For an inverse tangent calculation, an accurate estimate is required for only a small range. This is also true of most other trigonometric functions. For example, a good tradeoff for a double-precision inverse tangent implementation would require an input range of 0-2⁻¹⁰ radians. For 52-bit precision as used in double-precision arithmetic, with a 10-bit input range, the second term would be 20 bits (x³−x) to the right of the first term, and the third term would be 40 bits (x⁵−x) to the right. The next term would be 60 bits to the right, and therefore can be ignored for this example of 52-bit precision. However, the invention would apply no matter how many terms were used.

As the second term is 20 bits to the right, it will have a maximum contribution of 32 bits (52 bits-20 bits) to the final result, and can therefore be well-represented with 36-bit precision. Similarly, as the third term is 40 bits to the right, it will have a maximum contribution of only 12 bits, and can therefore be well-represented by 18 bits.

If the input is less than 2⁻¹⁰, then the following terms will have even smaller contributions based on their powers. For example, if the input is 2⁻¹², the second term will be 24 bits to the right and the third term will be 48 bits to the right. For inputs of 2⁻¹⁴ or less, even the third term contribution will be more than 56 bits to the right and make a negligible contribution to the result.

A full floating-point adder is not required to add together the terms. As long as the input is less than (or equal to) 1, each term will be less than its preceding term, so that swapping of operands is not required, and denormalization can be applied to the smaller term immediately. In fact, the denormalization shift can be applied directly to all of the following terms immediately, as each can be calculated in relation to the first term simultaneously.

For inputs greater than 1, the higher-order terms tend to make an increasingly, rather than decreasingly, dominant contribution. However, the denormalization techniques described herein can still apply.

As noted above, according to embodiments of the invention, the denormalization shifts are not applied as separate operations, but are applied to the coefficients. Therefore, they may be implemented as multiplications by constants. For example, in current PLD (e.g., FPGA) architectures, it is usually more efficient to implement such multiplications in specialized processing blocks (e.g., DSP blocks) that include fixed arithmetic structures with configurable interconnect, rather than in general-purpose programmable logic.

Regardless of how the multiplication operations are implemented, in accordance with embodiments of the invention, each coefficient may be represented by a table of shifted coefficients. The exponent of the term to which the coefficient is applied determines the required degree of shifting, and therefore functions as an index into the coefficient table.

Examples of the coefficient tables for the inverse tangent example, described above, where the inputs are less than 1, are shown in Tables 1 and 2 (below) for the second and third terms, respectively, of the “inner series” of Equation (4). The value in the first column of each table is the address/index corresponding to the exponent of the value of the input x, expressed in binary form. The value in the second column of each table is the coefficient itself. From each entry to the next, the coefficient, if expressed in binary form, would be shifted by the product of the index and the power of the corresponding term of the series. However, to save space, the shifted coefficient values, which are signed binary numbers, are represented by the equivalent hexadecimal values. Thus, in Table 1, the coefficient values are eight-character hexadecimal values representing 32-bit signed binary values, while in Table 2, the coefficient values are five-character hexadecimal values representing 20-bit signed binary values:

TABLE 1 Index Coefficient 00000 AAAAAAAA 00001 EAAAAAAA 00010 FAAAAAAA 00011 FEAAAAAA 00100 FFAAAAAA 00101 FFEAAAAA 00110 FFFAAAAA 00111 FFFEAAAA 01000 FFFFAAAA 01001 FFFFEAAA 01010 FFFFFAAA 01011 FFFFFEAA 01100 FFFFFFAA 01101 FFFFFFEA 01110 FFFFFFFA 01111 FFFFFFFE 10000 FFFFFFFF >10000 00000000

TABLE 2 Index Coefficient 00000 1999A 00001 0199A 00010 0019A 00011 0001A 00100 00002 >00100 00000

In the examples shown, the second term will have 17 possible exponent values including the original unshifted value (32 bits of input range, with each successive shifted value decreasing by 2 bits per bit of reduction of the input power) as shown in Table 1, and the third term will have five possible exponent values including the original unshifted value (18 bits of input range, with each successive shifted value decreasing by 4 bits per bit of reduction of the input power) as shown in Table 2. In other embodiments, these tables may be somewhat larger, to allow at least some small contribution into the least significant bit position of the result.

FIG. 1 shows an embodiment of circuitry 100 for implementing Equation (4) according to an embodiment of the invention.

The input 101 is in double-precision format, including a 52-bit mantissa 111 (not including an implied leading ‘1’) and an 11-bit exponent 121. As part of the conversion to fixed-point processing, the mantissa is expanded to 53 bits by converting the implied leading ‘1’ to an actual leading ‘1’. The x³ term is calculated to 36-bit precision, by multiplying x by itself using a 36×36 bit fixed-point multiplier 101, and multiplying that result by x using another 36×36 bit fixed-point multiplier 102. The upper 36 bits of x are used in each multiplication operation. x is inherently aligned with itself for the first fixed-point operation, while x² is aligned with x for the second fixed-point operation.

To calculate the “inner series” of Equation (4), the upper 18 bits of the x² term are multiplied, using fixed point multiplier 103, with the output of the third term coefficient table 107. Third term coefficient table 107 is addressed by the input exponent through address circuitry 117, to select the properly-shifted version of the coefficient, which is provided in an unnormalized fixed-point format. The result of that multiplication, right-shifted by 20 bits, is added to the 36-bit output of the second term coefficient table 108, which also is provided in an unnormalized fixed-point format, using a 36-bit fixed-point adder 104. Like third term coefficient table 107, second term coefficient table 108 is indexed by the input exponent through address circuitry 318 to select the properly-shifted version of the coefficient.

That completes the first two terms of the “inner series.” As noted above, in this example, the third and subsequent terms are beyond the 52-bit precision of the system and therefore need not be computed. For systems of different precision, or where different numbers of bits are provided in the inputs or coefficients, it is possible that a different number of terms of the “inner series” may be calculated.

The 36-bit inner series result is then multiplied by the x² term using a 36×36-bit fixed-point multiplier 305. The upper 36 bits of that product, right-shifted by 20 bits, are added to the prefixed input mantissa 101 by 53-bit fixed point adder 106.

The mantissa is then normalized. Because the sum of all of the following terms would always be very small—i.e., less than 0.5₁₀—only a 1-bit normalization is needed (i.e., a 1-bit shift will be applied where needed). The 1-bit normalization can be carried out using a 52-bit 2:1 multiplexer 109.

As can be seen, this example uses two 36×36 fixed-point multipliers (101 and 105) and two 18×18 fixed-point multipliers (102 and 103), as well as one 36-bit fixed-point adder 304, one 53-bit fixed-point adder 106, and one 52-bit 2:1 multiplexer, as well as memories for the coefficient tables 107, 108. In all, if this example is implemented in a STRATIX® PLD of the type described above, 188 adaptive look-up tables and 14 18×18 fixed-point multipliers are used. This is much smaller than previously-known hardware implementations of Horner's method.

Specifically, a brute-force double-precision floating-point implantation of Equation (4) would use about 4000 adaptive look-up tables and 27 18×18 fixed-point multipliers. By finding an optimal translation to fixed-point arithmetic, the required resources are greatly reduced when implementing the present invention. The latency also is much smaller, at about 10 clocks, which is less than the latency of a single double-precision floating-point multiplier or adder by itself.

Although the example described above in connection with FIG. 1 is based on x≦1 and involved a polynomial including only odd powers of x (x³, x⁵, . . . ), the invention can be used with a polynomial including only even powers of x (x², x⁴, . . . ) or including all powers of x (x², x³, x⁴, x⁵, . . . ). More generally, the higher powers would be multiplied out first, and the lower powers would be computed by shifting relative to the higher powers, with that shifting coded into the coefficient tables. Looked at another way, a power of x, up to the largest common power of x greater than 1 (x³ in the example, but possibly as low as x²) would be factored out and multiplied first. Only terms in the remaining factored polynomial whose powers of x did not exceed the precision of the system would be retained. Each term would be shifted according to its power of x, with that shifting being coded into the coefficient tables, to provide an intermediate result. That intermediate result would be multiplied by the factored-out common power of x to provide the final result.

Although these techniques have been described so far for cases where |x|≦1 (sign being handled separately using known techniques), the techniques can be generalized for polynomials in which |x| has any value, whether greater than 1 or less than or equal to 1.

FIG. 2 shows the alignment of the terms for various ranges of input values for a simplified exemplary floating-point format with 5 fractional or mantissa bits. The number of bits in an actual implementation would be determined by the precision desired. For example, according the IEEE754-2008 standard for implementing floating-point arithmetic in electronic devices, “half-precision” numbers have 5 exponent bits and 11 mantissa bits, “single-precision” numbers have 8 exponent bits and 23 mantissa bits, “double-precision” numbers have 11 exponent bits and 52 mantissa bits, and “quadruple-precision” numbers have 15 exponent bits and 112 mantissa bits.

As already noted, as x gets closer to zero, the higher order terms (i closer to n) also tend to zero, and have an increasingly lower contribution in the final result. In fact, below a certain threshold value of x very close to zero, even the contribution of the i=1 term xa₁ may have a weight lower than the accuracy of the i=0 term a₀. In such a case the result of the evaluation would be a₀.

Indeed, the range of the exponent that needs to be examined may be smaller than the actual range of the exponent of the input. For many functions f(x), such as certain trigonometric functions, f(x)≈x when x is very small (to the precision required to represent the result accurately). For example, for the inverse tangent function (arctan), all inputs smaller than (i.e., having exponents at least as highly negative as) exponent=−30 will return the same value in double precision, even though the exponent in double precision can be as small as (i.e., as highly negative as) −1022.

In FIG. 2, term alignment 200, where the exponent of x is zero, meaning that x is a binary number between 1.0 and 1.1111 . . . , equivalent to a decimal number between 1.0 and 1.9999 . . . (i.e., between 1 and 2, as indicated), may be considered a baseline alignment. Term alignments 201, 202, 203, 204 in the lower portion of FIG. 2 represent decreasing values of the exponent of x, and corresponding decreasing values of the range of x as indicated. Term alignments 205, 206, 207 in the upper portion of FIG. 2 represent increasing values of the exponent of x, and corresponding increasing values of the range of x as indicated. As the value of x increases, the higher order terms tend to make an increasingly dominant contribution to the final result.

Whether x≦1 or x>1, two factors contribute to the relative alignment of the terms. A first factor, which is contributed by the coefficients, is fixed and could be hardwired in a fixed-point implementation. A second factor, which is contributed by x^(i), and specifically by the exponent of x, can either be positive (when x>1), or negative (when x≦1).

An example where n=2 is illustrative: p(x)=a ₀ +x(a ₁ +xa ₂) For simplicity, assume that the signs of the coefficients and of x are positive: p(x)=2^(e) ^(a0) 1·f _(a0)+2^(e) ^(x) 1·f _(x)(2^(e) ^(a1) 1·f _(a1)+(2^(e) ^(x) 1·f _(x)×2^(e) ^(a2) 1·f _(a2))) where for any number q represented in binary form, e_(q) is the exponent of q and f_(q) is the mantissa of q. This may be regrouped as follows to associate the scaling produced by x^(i) with the corresponding coefficient a_(i): p(x)=2^(e) ^(a0) 1·f _(a0)+1·f _(x)(2^((e) ^(a1) ^(+e) ^(x) ⁾1·f _(a1)+1·f _(x)(2^((e) ^(a2) ^(+2e) ^(x) ⁾1·f _(a2))) where 2^((e) ^(a1) ^(+e) ^(x) ⁾1·f_(a1) represents a₁ scaled by e_(x), and 2^((e) ^(a2) ^(+2e) ^(x) ⁾1·f_(a2) represents a₂ scaled by 2e_(x).

The tabulated shifts for the coefficients when x≦1 have a particular pattern relative to a₀ (table 301) as presented in FIG. 3. Coefficient a₁ (table 302) is shifted right in increments of one binary position as the e_(x) decreases. Coefficient a₂ (table 303) is shifted right in increments of two positions as e_(x) decreases, and so on through a_(n) (here a₃, table 304)

Thus, for x≦1 the evaluation of the polynomial can be performed as a fixed-point operation, once the terms of order greater than zero are aligned against a₀. The alignment of each term depends only on the exponent of x, e_(x). Therefore, the correspondingly aligned coefficient may be obtained from a table indexed by e_(x).

As previously noted, for the case where x>1, the dominant terms will be the higher-order terms. In this case, we can write the same example polynomial to align the lower-order terms against the highest-order term, scaling up the final result by 2^(2e) ^(x) , or more generally, by 2^(ne) ^(x) for an nth-order polynomial (in this example, n=2): p(x)=2^(e) ^(a0) 1·f _(a0)+1·f _(x)(2^((e) ^(a1) ^(+e) ^(x) ⁾1·f _(a1)+1·f _(x)(2^((e) ^(a2) ^(+2e) ^(x) ⁾1·f _(a2)))=2^(2e) ^(x) (2^(e) ^(a0) ^(−2e) ^(x) 1·f _(a0)1·f _(x)(2^(e) ^(a1) ^(−e) ^(x) 1·f _(a1)+1·f _(x)(2^(e) ^(a2) 1·f _(a2)))) where 2^(e) ^(a0) ^(−2e) ^(x) 1·f_(a0) represents a₀ scaled by 2e_(x), and 2^(e) ^(a1) ^(−e) ^(x) 1·f_(a1) represents a₁ scaled by e_(x).

Similarly to the x≦1 case, in the x>1 case, the tabulated shifts for the coefficients when have a particular pattern relative to a_(n)x^(n) presented in FIG. 4. The relative shifts of the coefficients with respect to a_(n) (here a₃, table 401) depend only on e_(x), as follows. Coefficient a_(n−1) (here a₂, table 402) will be shifted right in increments of one position, coefficient a_(n−2) (here a₁, table 403) will be shifted right in increments of two positions, and so on through a_(n−n=a0) (table 404).

Examination of the coefficient tables of FIGS. 3 and 4 reveals that for any given coefficient a_(i), there is a substantial overlap between the coefficient table for that coefficient in FIG. 3 (x≦1) and the coefficient table for that coefficient in FIG. 4 (x>1). Therefore, in accordance with embodiments of the present invention, it is possible to create merged coefficient tables as shown in FIG. 5.

In FIG. 5, a respective table for each coefficient a_(i) contains all the possible shift cases for that particular coefficient. Thus, each respective table includes a union between the required shift cases for the respective coefficient for x≦1 and the required shift cases for the respective coefficient for x>1, with duplicate shift cases eliminated. In the merged coefficient tables 501-504 of FIG. 5, shifts corresponding to x≦1 are hatched in one direction, shifts corresponding to x>1 are hatched in the other direction, and shifts corresponding to both cases are crossed-hatched.

To the extent that the shifted coefficient values may be in floating-point format, then in accordance with embodiments of the invention, they may be converted to fixed-point format, preserving the width, including the contribution to the width of any guard bits. Taking this format into account, a floating-point output may be constructed using the output fixed-point value and the exponent value of x.

The tables may be structured as follows:

For the case of x≦1, the maximum exponent value that will have to be decoded is 0. The minimum exponent value e_(min) that will have to be decoded is that which would cause the contribution of the i=1 term xa₁ to have a weight lower than the accuracy of the i=0 term a₀. In such a case, as noted above, for all values of the e_(x) smaller than e_(min), the output would be a₀, because for those values of e_(x), all other values will be shifted beyond the precision of the available representation. One way to accomplish this is to have the last entry in each table store a coefficient value of 0, and to decode all exponent values smaller than e_(min) to the address of that last entry.

Similarly, for the case of x>1, the minimum exponent value that will have to be decoded is 0. The maximum exponent value e_(max) that will have to be decoded is that which would cause the contribution of the (n−1)th term to be below the precision of the dominant term a_(n)x^(n) and therefore to be discarded. Again, one way to accomplish this is to have the last entry in each table store a coefficient value of 0, and to decode all exponent values larger than e_(max) to the address of that last entry.

FIG. 6 shows an embodiment of circuitry 600 for implementing merged coefficient tables according to an embodiment of the invention.

The variable x is input at 601. The sign and mantissa components of x are input at 611 to multipliers 602, 612, 622. In the case of multiplier 602, for the highest-order term, x is multiplied by the coefficient, selected from table 501 as described below. Implementing Horner's rule, the output of multiplier 602, and of each succeeding multiplier is added at one of adders 603 to the next most significant coefficient from tables 502/503/504, and then multiplied again by x at the next multiplier 612/622. The sum involving the least significant coefficient from table 504 is, in accordance with the Horner's rule formulation, not further multiplied.

Each table 501-504 is stored in a respective separate table memory 604/614/624/634, or in a respective portion of a single memory. For example, various models of FPGAs available from Altera Corporation, of San Jose, Calif., include embedded memory modules in addition to the blocks of programmable logic. The exponent portion of x is routed at 621 to decoders 605 which use the exponent data to select the correct coefficient from each table memory 604/614/624/634. Decoders 605 may be implemented as simple table lookups. For example, in the foregoing FPGAs from Altera Corporation, those table lookups may be implemented in the look-up tables that are provided as logic elements.

The exponent portion of x also is routed to normalization and exception-handling logic 606, where the exponent data are used to normalize the output mantissa 607, and is further routed to logic (not shown) to determine the output exponent.

As an alternative to the set of integrated coefficient tables 501-504, each respective one of coefficient memories 604/614/624/634 could store a respective set of coefficient tables, as in FIGS. 3 and 4, for different ranges of x. In that case, decoders 605 would select the correct coefficient table from each respective set of coefficient tables based on the range of x, and then would select the correct coefficient value from each of the selected tables.

Thus it is seen that circuitry and methods for performing polynomial calculations have been provided. This invention may have use in hard-wired implementations of polynomial calculations, as well as in software implementations.

Another potential use for the present invention may be in programmable devices such as PLDs, as discussed above, where programming software can be provided to allow users to configure a programmable device to perform polynomial calculations, either as an end result or as part of a larger operation. The result would be that fewer logic resources of the programmable device would be consumed. And where the programmable device is provided with a certain number of dedicated blocks for arithmetic functions (to spare the user from having to configure arithmetic functions from general-purpose logic), the number of dedicated blocks needed to be provided (which may be provided at the expense of additional general-purpose logic) can be reduced (or sufficient dedicated blocks for more operations, without further reducing the amount of general-purpose logic, can be provided).

Instructions for carrying out a method according to this invention for programming a programmable device to perform polynomial calculations, may be encoded on a machine-readable medium, to be executed by a suitable computer or similar device to implement the method of the invention for programming or configuring PLDs or other programmable devices to perform operations as described above. For example, a personal computer may be equipped with an interface to which a PLD can be connected, and the personal computer can be used by a user to program the PLD using a suitable software tool, such as the QUARTUS® II software available from Altera Corporation, of San Jose, Calif.

FIG. 7 presents a cross section of a magnetic data storage medium 800 which can be encoded with a machine executable program that can be carried out by systems such as the aforementioned personal computer, or other computer or similar device. Medium 800 can be a floppy diskette or hard disk, or magnetic tape, having a suitable substrate 801, which may be conventional, and a suitable coating 802, which may be conventional, on one or both sides, containing magnetic domains (not visible) whose polarity or orientation can be altered magnetically. Except in the case where it is magnetic tape, medium 800 may also have an opening (not shown) for receiving the spindle of a disk drive or other data storage device.

The magnetic domains of coating 802 of medium 800 are polarized or oriented so as to encode, in manner which may be conventional, a machine-executable program, for execution by a programming system such as a personal computer or other computer or similar system, having a socket or peripheral attachment into which the PLD to be programmed may be inserted, to configure appropriate portions of the PLD, including its specialized processing blocks, if any, in accordance with the invention.

FIG. 8 shows a cross section of an optically-readable data storage medium 810 which also can be encoded with such a machine-executable program, which can be carried out by systems such as the aforementioned personal computer, or other computer or similar device. Medium 810 can be a conventional compact disk read-only memory (CD-ROM) or digital video disk read-only memory (DVD-ROM) or a rewriteable medium such as a CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, DVD+RW, or DVD-RAM or a magneto-optical disk which is optically readable and magneto-optically rewriteable. Medium 810 preferably has a suitable substrate 811, which may be conventional, and a suitable coating 812, which may be conventional, usually on one or both sides of substrate 811.

In the case of a CD-based or DVD-based medium, as is well known, coating 812 is reflective and is impressed with a plurality of pits 813, arranged on one or more layers, to encode the machine-executable program. The arrangement of pits is read by reflecting laser light off the surface of coating 812. A protective coating 814, which preferably is substantially transparent, is provided on top of coating 812.

In the case of magneto-optical disk, as is well known, coating 812 has no pits 813, but has a plurality of magnetic domains whose polarity or orientation can be changed magnetically when heated above a certain temperature, as by a laser (not shown). The orientation of the domains can be read by measuring the polarization of laser light reflected from coating 812. The arrangement of the domains encodes the program as described above.

A PLD 90 programmed according to the present invention may be used in many kinds of electronic devices. One possible use is in a data processing system 900 shown in FIG. 9. Data processing system 900 may include one or more of the following components: a processor 901; memory 902; I/O circuitry 903; and peripheral devices 904. These components are coupled together by a system bus 905 and are populated on a circuit board 906 which is contained in an end-user system 907.

System 900 can be used in a wide variety of applications, such as computer networking, data networking, instrumentation, video processing, digital signal processing, or any other application where the advantage of using programmable or reprogrammable logic is desirable. PLD 90 can be used to perform a variety of different logic functions. For example, PLD 90 can be configured as a processor or controller that works in cooperation with processor 901. PLD 90 may also be used as an arbiter for arbitrating access to a shared resources in system 900. In yet another example, PLD 90 can be configured as an interface between processor 901 and one of the other components in system 900. It should be noted that system 900 is only exemplary, and that the true scope and spirit of the invention should be indicated by the following claims.

Various technologies can be used to implement PLDs 90 as described above and incorporating this invention.

It will be understood that the foregoing is only illustrative of the principles of the invention, and that various modifications can be made by those skilled in the art without departing from the scope and spirit of the invention. For example, the various elements of this invention can be provided on a PLD in any desired number and/or arrangement. One skilled in the art will appreciate that the present invention can be practiced by other than the described embodiments, which are presented for purposes of illustration and not of limitation, and the present invention is limited only by the claims that follow. 

What is claimed is:
 1. Polynomial circuitry for calculating a polynomial having terms including powers of an input variable, said input variable represented by a mantissa and an exponent, said circuitry comprising: at least one respective coefficient table corresponding to a respective one of said terms of said polynomial; wherein: for each respective one of said terms of said polynomial, each respective coefficient table is loaded with a plurality of respective instances of a respective coefficient for said respective one of said terms of said polynomial, and respective instances of said respective coefficient for said respective one of said terms of said polynomial are multiple versions of said respective coefficient, each version being shifted by a different number of bits; and respective decoder circuitry associated with each respective one of said coefficient tables, said respective decoder circuitry selecting one of said instances of said respective coefficient for said respective one of said terms of said polynomial based on said exponent and on a range, from among a plurality of ranges, of input values into which said input variable falls.
 2. The polynomial circuitry of claim 1 wherein said range of input values is determined solely by said exponent.
 3. The polynomial circuitry of claim 1 wherein: each said at least one respective coefficient table for said respective one of said terms of said polynomial comprises a plurality of sets of coefficient values for each said respective term; and each of said sets of coefficient values applies to a respective one of said ranges.
 4. The polynomial circuitry of claim 3 wherein: each said at least one respective coefficient table for said respective one of said terms of said polynomial comprises a separate table for each of said sets of coefficient values; and each of said separate tables is stored in a separate memory.
 5. The polynomial circuitry of claim 3 wherein: each said at least one respective coefficient table for said respective one of said terms of said polynomial comprises a separate table for each of said sets of coefficient values; and all of said separate tables are stored in a single memory.
 6. The polynomial circuitry of claim 3 wherein, for one of said respective terms, at least one coefficient value for said one of said respective terms of said polynomial in one of said sets of coefficient values is identical to a coefficient value for said one of said respective terms of said polynomial in another of said sets of coefficient values.
 7. The polynomial circuitry of claim 6 wherein each of said sets of coefficient values is stored separately in a single memory.
 8. The polynomial circuitry of claim 6 wherein: said sets of coefficient values are interleaved in said single memory, said single memory containing a respective interleaved table for each respective one of said terms of said polynomial; and said decoder circuitry selects an appropriate coefficient for each respective term from each respective interleaved table.
 9. The polynomial circuitry of claim 3 comprising: a respective coefficient memory for a respective one of said terms of said polynomial; wherein: all respective coefficient values from all of said sets of coefficient values for said one of said respective terms of said polynomial are stored in said respective coefficient memory.
 10. The polynomial circuitry of claim 9 wherein each respective set of coefficient values for said one of said respective terms is stored in a separate respective coefficient table that is stored in said respective coefficient memory for said one of said respective terms.
 11. The polynomial circuitry of claim 9 wherein: said respective sets of coefficient values are interleaved in a single interleaved table in said respective coefficient memory; and said decoder circuitry selects an appropriate coefficient for said respective one of said terms of said polynomial from said interleaved table.
 12. A method of configuring a programmable device as circuitry calculating a polynomial having terms including powers of an input variable, said input variable represented by a mantissa and an exponent, said method comprising: configuring, on said programmable device: at least one respective coefficient table corresponding to a respective one of said terms of said polynomial; wherein: for each respective one of said terms of said polynomial, each respective coefficient table is loaded with a plurality of respective instances of a respective coefficient for said respective one of said terms of said polynomial, and respective instances of said coefficient for said respective one of said terms of said polynomial are multiple versions of said respective coefficient, each version being shifted by a different number of bits; and respective decoder circuitry associated with each respective one of said coefficient tables, said respective decoder circuitry selecting one of said respective instances of said coefficient for said respective one of said terms of said polynomial based on said exponent and on a range, from among a plurality of ranges, of input values into which said input variable falls.
 13. The method of claim 12 wherein said range of input values is determined solely by said exponent.
 14. The method of claim 12 wherein: each said at least one respective coefficient table for each said respective one of said terms of said polynomial comprises a plurality of sets of coefficient values for each said respective one of said terms of said polynomial; and each of said sets of coefficient values applies to a respective one of said ranges.
 15. The method of claim 14 wherein: each said at least one respective coefficient table for each said respective one of said terms of said polynomial comprises a separate table for each of said sets of coefficient values; said method comprising: configuring a separate memory on said programmable device for each of said coefficient tables.
 16. The method of claim 14 wherein: each said at least one respective coefficient table for each said respective term comprises a separate table for each of said sets of coefficient values; said method comprising: configuring a single memory on said programmable device for all of said coefficient tables.
 17. The method of claim 16 wherein, for one of said respective terms of said polynomial, at least one coefficient value for said one of said respective terms of said polynomial in one of said sets of coefficient values is identical to a coefficient value for said one of said respective terms of said polynomial in another of said sets of coefficient values.
 18. The method of claim 17 wherein: each of said sets of coefficient values is stored separately in said single memory; and said sets of coefficient values are interleaved in said single memory, said single memory containing a respective interleaved table for each respective one of said terms of said polynomial; said method further comprising: configuring said decoder circuitry to select an appropriate coefficient for each respective one of said terms of said polynomial from each respective interleaved table.
 19. The method of claim 17 comprising: configuring a respective coefficient memory for each one of said respective terms of said polynomial, for storing all respective coefficient values from all of said sets of coefficient values for said one of said respective terms of said polynomial in said respective coefficient memory.
 20. The method of claim 19 comprising configuring said respective coefficient memory to store each respective set of coefficient values for said one of said respective terms of said polynomial in a separate respective coefficient table.
 21. The method of claim 19 comprising: configuring said respective coefficient memory to store said respective coefficient values for said one of said respective terms of said polynomial in a single interleaved table in said respective coefficient memory; and configuring said decoder circuitry to select an appropriate coefficient for said respective one of said terms of said polynomial from said interleaved table.
 22. A non-transitory machine-readable data storage medium encoded with non-transitory machine-executable instructions for configuring a programmable device as circuitry for calculating a polynomial having terms including powers of an input variable, said input variable represented by a mantissa and an exponent, said instructions comprising: instructions to configure at least one respective coefficient table corresponding to a respective one of said terms of said polynomial, wherein: for each respective one of said terms of said polynomial, each respective coefficient table is loaded with a plurality of respective instances of a respective coefficient for said respective one of said terms of said polynomial, and respective instances of said coefficient for said respective one of said terms of said polynomial are multiple versions of said respective coefficient, each version being shifted by a different number of bits; and instructions to configure respective decoder circuitry associated with each respective one of said coefficient tables, said respective decoder circuitry selecting one of said instances of said respective coefficient for said respective one of said terms of said polynomial based on said exponent and on a range, from among a plurality of ranges, of values into which said input variable falls. 